package com.git.xxx.demo.controller;

import com.git.xxx.demo.log.LogUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class TestController {

    @Value("${provider.name}")
    private String providerName;

    @Value("${server.port}")
    private String providerPort;

    @GetMapping("/test")
    public String test(){
        LogUtils.getBussinessLogger().info("---------------------");
        return "这是["+providerName+":"+providerPort+"]提供的服务";
    }

    @GetMapping("/api/test")
//    @PreAuthorize("hasAnyRole('ROLE_PROJECT_ADMIN')")
    public String testApi(){
        return "这是["+providerName+":"+providerPort+"]提供的服务";
    }
}
